package cn.org.mrliu.ssm.common.mapper;

import java.util.List;

import cn.org.mrliu.ssm.common.model.BaseModel;

/**
 * <code>
 * <pre>
 * MyBatis公共的Mapper接口
 * </pre>
 * </code>
 * 
 * @author MrLiu
 *
 * @param <Model> 继承自BaseEntity
 */
public interface BaseMapper<Model extends BaseModel> {
	/**
	 * 保存
	 * @param model
	 * @throws Exception
	 */
	Integer save(Model model) throws Exception;
	
	/**
	 * 保存不为null的属性
	 * @param model
	 * @throws Exception
	 */
	Integer saveSelective(Model model) throws Exception;
	/**
	 * 修改
	 * @param model
	 * @throws Exception
	 */
	Integer update(Model model) throws Exception;
	
	/**
	 * 修改不为null的属性
	 * @param model
	 * @throws Exception
	 */
	Integer updateSelective(Model model) throws Exception;
	/**
	 * 删除
	 * @param id
	 * @throws Exception
	 */
	Integer delete(Integer id) throws Exception;
	/**
	 * 获取
	 * @param id
	 * @return
	 * @throws Exception
	 */
	Model get(Integer id) throws Exception;
	/**
	 * 根据条件获取个数
	 * @param param
	 * @return
	 * @throws Exception
	 */
	List<Integer> getIds(Object param) throws Exception;
	/**
	 * 根据条件获取数据列表
	 * @param param
	 * @return
	 * @throws Exception
	 */
	List<?> getList(Object param) throws Exception;
	/**
	 * 根据条件获取个数
	 * @param param
	 * @return
	 * @throws Exception
	 */
	Integer getCount(Object param) throws Exception;
	/**
	 * 根据条件获取分页列表
	 * @param param
	 * @return
	 * @throws Exception
	 */
	List<?> getPageList(Object param) throws Exception;
	/**
	 * 批量保存
	 * @param param
	 * @throws Exception
	 */
	Integer batchSave(Object param) throws Exception;
	/**
	 * 批量修改
	 * @param param
	 * @throws Exception
	 */
	Integer batchUpdate(Object param) throws Exception;
	/**
	 * 批量删除
	 * @param param
	 * @throws Exception
	 */
	Integer batchDelete(Object param) throws Exception;
}
